/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2021 Huawei Technologies Co., Ltd */

#ifndef HINIC3_XSA_H
#define HINIC3_XSA_H

#include "hinic3_ipsec.h"

struct hinic3_ipsec_sa_key {
	union {
		__be32 a4;
		__be32 a6[4];
	} daddr;
	__be32	spi;
	u8	proto;
};

struct hinic3_ipsec_esn_state {
	u32 esn;
	u8 esn_enable;
	u8 overlap;
};

/* IPsec SA Item */
struct hinic3_ipsec_sa {
	struct hlist_node hlist; /* Item in SADB hashtable */
	u32 xid;
	void *ctx; /* qpc context priv */
	u64 qpc_gpa;
	struct xfrm_state *xs;
	struct hinic3_ipsec *ipsec;
	struct hinic3_ipsec_esn_state esn_state;
};

struct xfrm_state *hinic3_ipsec_get_xs_by_xid(struct hinic3_ipsec *ipsec, u32 xid);

#endif /* _HINIC3_XSA_H_ */
